package io.bigbird0101.pay.business.service.impl;

import cn.hutool.core.bean.BeanUtil;
import io.bigbird0101.pay.business.service.dto.PayOrderDto;
import io.bigbird0101.pay.business.service.entity.PayOrder;
import io.bigbird0101.pay.business.service.mapper.PayOrderMapper;
import io.bigbird0101.pay.business.service.vo.PayOrderVo;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * @author bigbird-0101
 * @date 2024-04-11 22:46
 */
@Service
@RequiredArgsConstructor
public class PayOrderService {
    private final PayOrderMapper payOrderMapper;
    public PayOrderVo createPayOrder(PayOrderDto payOrder) {
        PayOrder entity = BeanUtil.copyProperties(payOrder, PayOrder.class);
        payOrderMapper.insert(entity);
        return BeanUtil.copyProperties(entity, PayOrderVo.class);
    }
    
    public PayOrderVo getPayOrderById(Long id) {
        PayOrder entity = payOrderMapper.selectById(id);
        return BeanUtil.copyProperties(entity, PayOrderVo.class);
    }
}
